﻿<extend name="Public:base" />
<block name="title">
    <title>快速注册</title>
</block>
<block name="header_styles">

</block>
<block name="main">
    <div class="register-container">
        <div class="register-form">
            <form action="" method="POST" id="form_signup2">
                <div class="form-section">
                    <div class="form-section-heading">
                        设置企业LOGO
                    </div>
                    <div class="form-section-content">
                        <iframe src="{:U('/Index/sp')}" scrolling="no" frameborder="0" width="502" height="360" class="photo"></iframe>
                        <div class="help-block text-center">
                            上传您的企业LOGO使您的企业看起来更可靠，最佳尺寸为300*300像素
                        </div>
                        <div class="text-center">
                            <span data-valmsg-for="uploadurl" data-valmsg-replace="true"></span>
                        </div>
                    </div>
                </div>
                <input type="text" name="uploadurl" id="uploadurl" data-val="true" data-val-required="请上传头像并裁剪" class="opacity0" value="" />
                <div class="form-section">
                    <div class="form-section-heading">
                        必填信息
                    </div>
                    <div class="form-section-content form-horizontal">
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                企&nbsp;业&nbsp;全&nbsp;称
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="companyname" name="companyname" placeholder="在此处输入企业名称" maxlength="20" data-val="true"
                                       data-val-required="请此处输入企业名称" data-val-remote="该企业名称已存在" data-val-remote-url="{:U('Login/signup_checkNicknameAjax')}" />
                                <span data-valmsg-for="companyname" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                企&nbsp;业&nbsp;简&nbsp;称
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" name="shortname" id="shortname" data-val="true" data-val-required="请输入企业简称" />
                                <span data-valmsg-for="shortname" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                所&nbsp;处&nbsp;行&nbsp;业
                            </label>
                            <div class="col-xs-8">
                                <input type="text" name="industry" id="industry" class="form-control" data-val="true" data-val-required="请输入所处行业" />
                                <span data-valmsg-for="industry" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">所&nbsp;&nbsp;&nbsp;在&nbsp;&nbsp;&nbsp;地</label>
                            <div class="col-xs-8">
                                <div class="row small">
                                    <div class="col-xs-4">
                                        <select id="ddlProvince" name="province" class="form-control" data-val="true" data-val-required="此处未选择"></select>
                                    </div>
                                    <div class="col-xs-2">
                                        <p class="form-control-static" style="white-space:nowrap;">省/市</p>
                                    </div>
                                    <div class="col-xs-4">
                                        <select id="ddlCity" name="city" class="form-control" data-val="true" data-val-required="此处未选择"></select>
                                    </div>
                                    <div class="col-xs-2">
                                        <p class="form-control-static" style="white-space:nowrap;">市/区</p>
                                    </div>
                                </div>
                                <span data-valmsg-for="province" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                联&nbsp;&nbsp;&nbsp;系&nbsp;&nbsp;&nbsp;人
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="contactname" name="contactname" data-val="true" data-val-required="请输入联系人" maxlength="5" />
                                <span data-valmsg-for="contactname" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                移&nbsp;动&nbsp;电&nbsp;话
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="mobile" name="mobile"
                                       data-val="true" data-val-required="电话号码不能为空"
                                       data-val-regex="无效电话号码" data-val-regex-pattern="((\\d{2,5}-\\d{7,8})|(^(1[34587])[0-9]\\d{8}$))" maxlength="20" />
                                <span data-valmsg-for="tel" data-valmsg-replace="true"></span>
                                <div class="help-block" style="margin-bottom:0px;">(请填写您的手机号，以便般若虾的工作人员能及时联系上您)</div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                固&nbsp;定&nbsp;电&nbsp;话
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="telephone" name="telephone" placeholder="xxxx-xxxxxxxx"
                                       data-val-regex="无效电话号码" data-val-regex-pattern="([0-9]{3,4}-)?[0-9]{7,8}"
                                       data-val="true" data-val-required="请输入联系固定电话" />
                                <span data-valmsg-for="telephone" data-valmsg-replace="true"></span>
                                <div class="help-block" style="margin-bottom:0px;">(请填写您的固定电话，以便般若虾的工作人员能及时联系上您)</div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                联&nbsp;系&nbsp;邮&nbsp;箱
                            </label>
                            <div class="col-xs-8">
                                <input type="text" class="form-control" id="contactemail" name="contactemail" data-val="true" data-val-required="请输入联系邮箱" />
                                <span data-valmsg-for="contactemail" data-valmsg-replace="true"></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-section">
                    <div class="form-section-heading">
                        选填信息
                    </div>
                    <div class="form-section-content form-horizontal">
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                企&nbsp;业&nbsp;官&nbsp;网
                            </label>
                            <div class="col-xs-8">
                                <input type="text" id="website" name="website" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                企&nbsp;业&nbsp;简&nbsp;介
                            </label>
                            <div class="col-xs-8">
                                <textarea type="text" id="intro" name="intro" class="form-control"  rows="4"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-3">
                                企&nbsp;业&nbsp;文&nbsp;化
                            </label>
                            <div class="col-xs-8">
                                <textarea type="text" id="culture" name="culture" class="form-control"  rows="4"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-buttons text-center">
                    <button type="button" class="btn btn-success" id="btnSubmit">提交</button>
                </div>
            </form>
        </div>
    </div>
</block>
<block name="footer_scripts">

    <!--<script src="__Public__/js/location_cn.js"></script>-->
    <script type="text/javascript">
        function photoCropCompleted(url) {
            $("#uploadurl").val(url);
        }

        function resetButtonClick() {
            $("#uploadurl").val("");
        }
    </script>


    <script type="text/javascript">
        require(["jquery", "modules/message", "bootstrap", "libraries/location_cn", "libraries/common", "kendoui/kendo.web.min"], function ($, messageBox) {
            $(document).ready(function () {
                for (var item in cities) {
                    if (item == "请选择") {
                        $("#ddlProvince").append("<option value=''>" + item + "</option>");
                    } else {
                        $("#ddlProvince").append("<option value='" + item + "'>" + item + "</option>");
                    }
                }

                $("#ddlProvince").change(function () {
                    var selected = $(this).val();
                    if (selected != "") {
                        $("#ddlCity option").remove();
                        var selectCities = cities[selected];
                        for (var i = 0; i < selectCities.length; i++) {
                            $("#ddlCity").append("<option value='" + selectCities[i] + "'>" + selectCities[i] + "</option>");
                        }
                    }
                });

                $("#btnSubmit").click(function () {
                    if ($("#form_signup2").valid()) {
                        $("#btnSubmit").button("loading");
                        var postData = $("#form_signup2").serialize();
                        $.ajax({
                            url: "{:U('Login/signup_commitCompanyAjax')}",
                            type: "post",
                            data: postData,
                            dataType: "json",
                            success: function (data) {
                                $("#btnSubmit").button("reset");
                                var vdata = eval(data);
                                if (data.success == 1) {
                                    messageBox.alert({
                                        content: '注册成功，请激活账户。<button type="button" class="smallbtn btn-default active-account">发送激活邮件</button><br/><span id="smNotice" class="rpnotice"></span>',
                                        sure: function () {
                                            window.location.href = "{:U('/')}";
                                        },
                                        afterClose: function () {
                                            window.location.href = "{:U('/')}";
                                        }
                                    });
                                } else {
                                    messageBox.alert({ title: "失败", content: vdata.msg });
                                }
                            }
                        });
                    }
                });
            });

            $(document).on("click", ".active-account", function () {
                kendo.ui.progress($("#boxAlert"), true);
                var nickname = $('#companyname').val();
                var url = "{:U('/Login/activeaccount_ajax')}";
                $.post(url, { 'name': nickname }, function (data) {
                    kendo.ui.progress($("#boxAlert"), false);
                    var vdata = eval(data);
                    $('#smNotice').text(vdata.msg);
                    $('#smNotice').show();
                }, 'json');
            });
        });

    </script>
</block>
